package com.integral.xr.module.platform.dal.mysql.village;

import java.util.*;

import com.integral.xr.framework.common.pojo.PageResult;
import com.integral.xr.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.integral.xr.framework.mybatis.core.mapper.BaseMapperX;
import com.integral.xr.module.platform.dal.dataobject.village.VillageDO;
import org.apache.ibatis.annotations.Mapper;
import com.integral.xr.module.platform.controller.admin.village.vo.*;

/**
 * 村情展示 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface VillageMapper extends BaseMapperX<VillageDO> {

    default PageResult<VillageDO> selectPage(VillagePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<VillageDO>()
                .eqIfPresent(VillageDO::getTitle, reqVO.getTitle())
                .eqIfPresent(VillageDO::getAuthor, reqVO.getAuthor())
                .eqIfPresent(VillageDO::getContent, reqVO.getContent())
                .betweenIfPresent(VillageDO::getReportTime, reqVO.getReportTime())
                .eqIfPresent(VillageDO::getState, reqVO.getState())
                .eqIfPresent(VillageDO::getIsrelease, reqVO.getIsrelease())
                .eqIfPresent(VillageDO::getDeptId, reqVO.getDeptId())
                .likeIfPresent(VillageDO::getDeptName, reqVO.getDeptName())
                .eqIfPresent(VillageDO::getDeptCode, reqVO.getDeptCode())
                .betweenIfPresent(VillageDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(VillageDO::getId));
    }

}